<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use yii\widgets\Pjax;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\ChuangxinChuangyeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Chuangxin Chuangyes';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="chuangxin-chuangye-index" style="margin-bottom: 15px;">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <div class="col-lg-12 col-md-12">
        <?php
        $form = ActiveForm::begin([
                'action' => ['index'],
                'method' => 'get',
                'options' => ['class' => 'input-group col-md-12'],
                'fieldConfig' => [
                    'template' => '<div class="col-lg-12 col-md-12">{input}</div>',
                ]
            ])
        ?>
        
        <div class="col-md-4">
            <label style="float: left;margin-top: 5px;">姓名</label>
            <div style="overflow: hidden;">
                <?php
                $datas = app\models\ChuangxinChuangye::find()->all();
               if ($datas != null) {
                    foreach ($datas as $item) {
                        $source[] = $item->name;
                    }
                } else {
                    $source[] = array();
                }
                echo yii\jui\AutoComplete::widget([
                    'model' => $searchModel,
                    'attribute' => 'name',
                    'options'=>['style'=>'margin-left:10px'],
                    'clientOptions' => [
                        'source' => $source,
                    ],
                ]);
                ?>
            </div>
        </div>
        <div class="col-md-4">
            <label style="float: left;margin-top: 5px;">项目名称</label>
            <div style="overflow: hidden;">
                <?php
                if ($datas != null) {
                    foreach ($datas as $item) {
                        $source[] = $item->xiangmu_name;
                    }
                } else {
                    $source[] = array();
                }
                echo yii\jui\AutoComplete::widget([
                    'model' => $searchModel,
                    'attribute' => 'xiangmu_name',
                    'options'=>['style'=>'margin-left:10px'],
                    'clientOptions' => [
                        'source' => $source,
                    ],
                ]);
                ?>
            </div>
        </div>
        <div class="col-md-3 text-center">
            <?= Html::submitButton('搜索', ['class' => 'btn btn-primary']) ?>
            <?= Html::a('添加', ['create'], ['class' => 'btn btn-primary']) ?> 
        </div>
        
    </div>
    
<!--    <div class="col-md-12 text-right" style="margin: 15px 0 15px 15px;">
       
    </div>-->
    
    <?php ActiveForm::end(); ?>   
    
    
      <!--加载上传文件的对话框-->
    <?= $this->render('/upload/upload', ['model' => $model]) ?>
    
    <?php Pjax::begin(); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
          //  ['class' => 'yii\grid\SerialColumn'],

//            'id',
            'name',
            'xibie',
//            'sex',
//            'birthday',
             'xueli',
             'xuewei',
            // 'biye',
//             'zhuanye',
//             'zhicheng',
            // 'zhicheng_time',
            // 'zhengshu',
            // 'zhengshu_time',
            // 'jibie',
            // 'xiangmu_bianhao',
             'xiangmu_name',
             'xiangmu_type',
//             'fuzeren',
            // 'chengyuan',
            // 'jingfei',
            // 'lixiang_time',
            // 'jiexiang_time',
            // 'jiexiang_dengji',
            // 'other_teacher',
            // 'beizhu',

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view} {update} {delete}',
                'buttons' => [
                    //view button
                    'view' => function ($url) {
                        return Html::a('<span class="fa fa-search"></span>查看', $url, [
                                    'title' => Yii::t('app', 'View'),
                                  //  'class' => 'btn btn-primary btn-xs',
                        ]);
                    },
                            //update button
                            'update' => function ($url) {
                        return Html::a('<span class="fa fa-search"></span>编辑', $url, [
                                    'title' => Yii::t('app', 'Update'),
                                   // 'class' => 'btn btn-primary btn-xs',
                        ]);
                    },
                            //update button
                            'delete' => function ($url) {
                        return Html::a('<span class="fa fa-search"></span>删除', $url, [
                                    'title' => Yii::t('app', 'Delete'),
                                    'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
                                    'data-method' => 'post',
                                    'data-pjax' => '0',
                                  //  'class' => 'btn btn-primary btn-xs',
                        ]);
                    },
                        ],
            ],
        ],
    ]); ?>
<?php Pjax::end(); ?>
</div>
